import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

// const moduleName = process.env.VUE_APP_MATERIAL_API

const moduleName = commonBaseUrl('D') || 'material/'
const moduleNameTwo = commonBaseUrl('B')
const moduleNameThree = commonBaseUrl('A')
// 设计监理推送
export function designPush(data) {
  return request({
    url: moduleName + 'api/insVa/serviceb/pushToInsValForBService',
    method: 'post',
    data,
    hideMessage: true,
    showLoading: true
  })
}
// 下一步校验商机编码
export function nextSubCode(params) {
    return request({
        url: moduleName + 'api/insVa/it/ifCheckedSubNicheCode',
        method: 'post',
        params,
        showLoading: true
    })
}
export function isShowSubCode(params) {
    return request({
        url: moduleName + 'api/insVa/it/ifShowSubNicheCode',
        method: 'post',
        params,
        showLoading: true
    })
}
// 商机编码
export function getSubCode(params) {
    return request({
        url: moduleName + 'api/insVa/it/getSubNicheLIstByPrjId',
        method: 'post',
        params,
        showLoading: true
    })
}
export function saveSubCode(data) {
    return request({
        url: moduleName + 'api/insVa/it/saveSubNicheCode',
        method: 'post',
        data,
        showLoading: true
    })
}
// 验收获取的表格
export function getAcceptanceList(params) {
    return request({
        url: moduleName + 'api/insVa/it/queryInsValDetailsForZhiL',
        method: 'post',
        params,
        showLoading: true
    })
}
// 下一步强校验
export function doNextStrongcheck(params) {
    return request({
        url: moduleName + 'api/insVa/it/checkIfHaveInsValD',
        method: 'post',
        params,
        showLoading: true
    })
}
// 综合查询:验工计价详情 (验工计价详情)
export function queryInsValDetails(params) {
    return request({
        url: moduleName + 'api/insVa/module/queryInsValDetails',
        params,
        showLoading: true
    })
}
// 查询接口-购置套装软件
export function queryInsValDetailsTao(params) {
    return request({
        url: moduleName + 'api/insVa/it/queryInsValDetails',
        method: 'post',
        params,
        showLoading: true
    })
}
// 综合查询-项目操作:查询哪些服务编码没有返回预估单 (验工计价详情)
export function getServiceReceInspection(params) {
    return request({
        url: moduleName + 'api/insVa/module/getServiceReceInspection',
        params,
        showLoading: true
    })
}
export function getServiceReceInspectionNew(params) {
    return request({
        url: moduleName + 'api/insVa/module/getServiceReceInspection',
        params,
        showLoading: true
    })
}
// 综合查询-蓝色链接查看:查询接口
export function queryinsValDetailsByService(params) {
    return request({
        url: moduleName + 'api/insVa/it/queryinsValDetailsByService',
        params,
        method: 'post',
        showLoading: true
    })
}

// 综合查询-项目操作:获取物资信息
export function getMaterialInfo(params) {
    return request({
        url: moduleName + 'api/insVa/module/getMaterialInfo',
        method: 'post',
        params
    })
}
// 综合查询-项目操作:判断是否进行精度校验
export function checkIfValidatePrecision(params) {
    return request({
        url: moduleName + '/api/insVa/it/checkIfValidatePrecision?prjId=' + params,
        method: 'post',
        params
    })
}

// 综合查询-项目操作:校验验工计价数据返回值为1不执行(新增)
export function ifEngineeringVisa(params) {
    return request({
        url: moduleName + 'api/insVa/module/ifEngineeringVisa',
        method: 'post',
        params
    })
}

// 综合查询-项目操作:校验验工计价数据(新增)
export function getCheckInsVaData(data) {
    return request({
        url: moduleName + 'api/insVa/module/getCheckInsVaData',
        method: 'post',
        data
    })
}

// 综合查询-项目操作:获取已推送的验工计价数据(冲销)
export function getCheckIsPushNum(data) {
    return request({
        url: moduleName + 'api/insVa/module/getCheckIsPushNum',
        method: 'post',
        data
    })
}

// 综合查询-项目操作:更新验工计价明细（新增、修改、删除） // 确认 保存接口
export function updateInsVaDetails(data) {
    return request({
        url: moduleName + 'api/insVa/module/updateInsVaDetails',
        method: 'post',
        data,
        showLoading: true
    })
}

// 综合查询-项目操作:验工计价推送商合交易系统 // 确认 推送商合的接口
export function inspectionValuationPush(params) {
    return request({
        url: moduleName + 'api/insVa/module/inspectionValuationPush',
        method: 'post',
        params,
        showLoading: true
    })
}

// 综合查询-项目操作:验工计价推送商合交易系统 // 确认 推送商合的接口 (11104新街口)
export function insValProPush(data) {
    return request({
        url: moduleName + '/api/insVa/module/insValProPush',
        method: 'post',
        data,
        showLoading: true,
        hideMessage: true // 隐藏消息提示
    })
}
// 综合查询-项目操作:获取验工计价配置信息
export function getConfigInfo(data) {
    return request({
        url: moduleName + 'api/insVa/module/getConfigInfo',
        method: 'post',
        data
    })
}

// 综合查询-项目操作:校验该服务是否存在
export function selectExistServ(params) {
    return request({
        url: moduleName + 'api/insVa/module/selectExistServ',
        method: 'post',
        params
    })
}

// 综合查询-项目操作:验工计价调减(校验该项目是否已经过了完工审核节点)
export function getAccInfo(params) {
    return request({
        url: moduleName + 'api/insVa/module/getAccInfo',
        method: 'post',
        params
    })
}

// 综合查询-查看: 查看该项目验工计价是否展示扣罚金额（1-是，2-否）
export function checkIfInsVaFlow(params) {
    return request({
        url: moduleName + 'api/insVa/module/checkIfInsVaFlow',
        method: 'get',
        params
    })
}
// 综合查询-项目操作:验工计价调减(获取子项目和父项目的信息)
export function getChilAndParPrjInfo(params) {
    return request({
        url: moduleName + 'api/insVa/module/getChilAndParPrjInfo',
        method: 'post',
        params
    })
}

// 综合查询-项目操作:验工计价调减(单项工程首付款冲销)   // 确认 冲销按钮
export function updateInspectionValuOverallPro(data) {
    return request({
        url: moduleName + 'api/insVa/module/updateInspectionValuOverallPro',
        method: 'post',
        data,
        showLoading: true
    })
}
// 信息化
// 我的待办-套装软件:我的待办(年份月分列表)
export function getItAccInfo(params) {
    return request({
        url: moduleName + 'api/insVa/it/getItAccInfo',
        method: 'post',
        params
    })
}

// 我的待办-套装软件:我的待办(查询信息化项目预估单及明细)
export function queryinspectionValuationDetails_all(params) {
    return request({
        url: moduleName + 'api/insVa/it/queryinspectionValuationDetails_all',
        method: 'post',
        params
    })
}
// 我的待办-套装软件:我的待办(信息化验工计价明细更新（新增、修改、冲销）)
export function updateInsValIT(data) {
    return request({
        url: moduleName + 'api/insVa/it/updateInsValIT',
        method: 'post',
        data,
        showLoading: true
    })
}
export function updateInsValITNew(data) {
    return request({
        url: moduleName + 'api/insVa/it/updateInsValIT',
        method: 'post',
        data,
        showLoading: true
    })
}
// 我的待办-套装软件:我的待办(查看是否存在未推送商合的验工计价（冲销）)
export function getHaveInspection(params) {
    return request({
        url: moduleName + 'api/insVa/it/getHaveInspection',
        method: 'post',
        params
    })
}

// 综合查询:校验该项目是否允许发起验工计价
// export function checkProject(params) {
//     return request({
//         url: moduleName + 'api/insVa/module/checkProject',
//         method: 'post',
//         params
//     })
// }

// 自主研发 查询信息化项目预估单及明细(自主研发)
export const queryInsValDetails12 = (params) => {
    return request({
        url: `${moduleName}api/insVa/it/queryInsValDetails12`,
        method: 'post',
        params
    })
}

// 新增验工计价校验是否存在在途的流程及是否超出本月发起次数(新增、冲销)
export const ifHaveInsVal = (params) => {
    return request({
        url: `${moduleName}api/insVa/it/ifHaveInsVal`,
        method: 'post',
        params
    })
}

//  验工计价-项目操作-综合查询:设计监理费
export function queryinspectionValuationDetailsB(params) {
    return request({
        url: moduleName + 'api/insVa/module/queryinspectionValuationDetailsB',
        method: 'post',
        params
    })
}

//  验工计价-项目操作-综合查询:设计监理费
export function getServiceReceInspectionB(params) {
    return request({
        url: moduleName + 'api/insVa/module/getServiceReceInspectionB',
        method: 'post',
        params
    })
}

// 验工计价 - 我的待办  --下一步 && 回退————————————————————————————————————————↓
// 获取基本信息
export function getPrjDetail(params) {
    return request({
        url: moduleNameTwo + 'api/adjustment/queryPrjInfo',
        params
    })
}

// 获取流程信息(下一步流程需要参数)
export function getWFWorkItem(params) {
    return request({
        url: moduleNameTwo + 'tfinInfo/getWFWorkItem',
        method: 'get',
        params
    })
}
export function getWFWorkItemNew(params) {
    return request({
        url: moduleNameTwo + 'tfinInfo/getWFWorkItem',
        method: 'get',
        params
    })
}
export function insValNextCheck(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValNextCheck',
        method: 'post',
        data
    })
}
export function insValNextCheckNew(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValNextCheck',
        method: 'post',
        data
    })
}
// 下一步(打开提交页面校验)
export function queryTheNextStepFlag(params) {
    return request({
        url: moduleName + 'api/insVa/it/queryTheNextStepFlag',
        method: 'post',
        params
    })
}
export function queryTheNextStepFlagNew(data) {
    return request({
        url: moduleName + 'api/insVa/it/queryTheNextStepFlag',
        method: 'post',
        data
    })
}
// 回退&下一步 校验接口
export function selectIsPush(params) {
    return request({
        url: moduleName + 'api/insVa/it/selectIsPush',
        method: 'post',
        params
    })
}
export function selectIsPushNew(params) {
    return request({
        url: moduleName + 'api/insVa/it/selectIsPush',
        method: 'post',
        params
    })
}
export function itInsValSentToSH(params) {
    return request({
        url: moduleName + 'api/insVa/it/itInsValSentToSH',
        method: 'post',
        params
    })
}
export function itInsValSentToSHNew(params) {
    return request({
        url: moduleName + 'api/insVa/it/itInsValSentToSH',
        method: 'post',
        params
    })
}
export function cancelInspectionVaWorkflow(params) {
    return request({
        url: moduleName + 'api/insVa/it/cancelInspectionVaWorkflow',
        method: 'post',
        params
    })
}
export function cancelInspectionVaWorkflowNew(params) {
    return request({
        url: moduleName + 'api/insVa/it/cancelInspectionVaWorkflow',
        method: 'post',
        params
    })
}
// 下一步:预算校验接口
export function budgetControlByItAccId(params) {
    return request({
        url: moduleName + 'api/insVa/module/budgetControlByItAccId',
        method: 'post',
        params
    })
}
export function budgetControlByItAccIdNew(params) {
    return request({
        url: moduleName + 'api/insVa/module/budgetControlByItAccId',
        method: 'post',
        params
    })
}
// 下一步:附件校验接口
export function checkValid(data) {
    return request({
        url: moduleNameThree + 'api/attachment/file/checkValid',
        method: 'post',
        data
    })
}
export function checkValidNew(data) {
    return request({
        url: moduleNameThree + 'api/attachment/file/checkValid',
        method: 'post',
        data,
        hideMessage:true
    })
}

// 取消申请:取消流程时查看是否还有本次填写的验工计价校验接口
export function getItInspection(params) {
    return request({
        url: moduleName + 'api/insVa/it/getItInspection',
        method: 'post',
        params
    })
}
export function getItInspectionNew(params) {
    return request({
        url: moduleName + 'api/insVa/it/getItInspection',
        method: 'post',
        params
    })
}
// 查看考核结果 (需要参数)
export function generateMD(params) {
    return request({
        url: moduleName + 'api/insVa/it/generateMD5Hash',
        method: 'post',
        params
    })
}
export function generateMDNew(params) {
    return request({
        url: moduleName + 'api/insVa/it/generateMD5Hash',
        method: 'post',
        params
    })
}
// 查看考核结果 (需要参数): 获取用户信息接口
export function getUserInfo(params) {
    return request({
        url: moduleName + 'api/platform/getUserInfo', // 斜杠
        method: 'get',
        params
    })
}
export function getUserInfoNew(params) {
    return request({
        url: moduleName + 'api/platform/getUserInfo', // 斜杠
        method: 'get',
        params
    })
}
// 查看考核结果 (需要参数): 获取token(登录信息)接口 // 确认
export function applyTokenByCode(params) {
    return request({
        url: moduleName + 'api/platform/apply4ATokenByCode',
        method: 'get',
        params,
        showLoading: true
    })
}
export function applyTokenByCodeNew(params) {
    return request({
        url: moduleName + 'api/platform/apply4ATokenByCode',
        method: 'get',
        params,
        showLoading: true
    })
}
// 下一步 回退 提交按钮
export function insValFlowBiz(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValFlowBiz',
        method: 'post',
        data,
        showLoading: true
    })
}
export function insValFlowBizNew(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValFlowBiz',
        method: 'post',
        data,
        showLoading: true
    })
}
// 回退 提交按钮
export function insValFlowBackBiz(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValFlowBackBiz',
        method: 'post',
        data,
        showLoading: true
    })
}
export function insValFlowBackBizNew(data) {
    return request({
        url: moduleName + 'api/insVa/it/insValFlowBackBiz',
        method: 'post',
        data,
        showLoading: true
    })
}
//  /api/insVa/it/addInsVal
// 保存
export function addInsVal(data) {
    return request({
        url: moduleName + 'api/insVa/it/addInsVal',
        method: 'post',
        data,
        showLoading: true
    })
}

export function delInsVal(params) {
    return request({
        url: moduleName + 'api/insVa/it/delInsVal',
        method: 'post',
        params,
        showLoading: true
    })
}

export function selectItAccInfo(params) {
    return request({
        url: moduleName + 'api/insVa/it/selectItAccInfo',
        method: 'post',
        params,
        showLoading: true
    })
}

// 项目编码跳转时获取token和url
export function getShopTokenAndUrl(params) {
    return request({
        url: moduleName + `api/retreat/getShopTokenAndUrl`,
        method: 'post',
        params
    })
}

// 验工计价冲销:(0528冲销时,验工计价包含损失款时)获取损失款

export function getSumLossByVid(params) {
    return request({
        url: moduleName + `api/insVa/module/getSumLossByVid`,
        method: 'post',
        params
    })
}
// 研发 获取验工计价表格
export function getInsValTable(params) {
    return request({
        url: moduleName + 'api/insVa/module/queryInsVals',
        method: 'get',
        params
    })
}

// 智联服务成本增加摊销起始日期 下一步校验接口
export function newDoNextCheckVerfic(data) {
    return request({
        url: moduleName + `api/insVa/it/checkIfSaveShareDate?prjId=${data.prjId}&iTAccId=${data.iTAccId}`,
        method: 'post',
    })
}
// 保存时间接口
export function saveTime(data) {
    return request({
        url: moduleName + 'api/insVa/it/saveShareDate',
        method: 'post',
        data
    })
}

